home *** CD-ROM | disk | FTP | other *** search
- /*
- GraphElements.h
-
- Basic Graphic Elements for version 3.0
-
- Copyright 1994 by Al Evans. All rights reserved.
-
- 12/8/93
-
- Updated for GE for Windows 95 1.0, 11/29/95
- */
-
- #ifndef GRAPHELEMENTS
- #define GRAPHELEMENTS
-
- #include "DispCtrl.h"
- #include "fastbcpy.h"
-
- #ifdef __cplusplus
- extern "C" {
- #endif
-
- //-------------------------------------------------------------------------------------
- // Simple PICT-based Graphic Element
- //-------------------------------------------------------------------------------------
-
- GrafElPtr NewBasicPICT(GEWorldPtr world, OSType id, short plane, short resNum,
- short mode, short xPos, short yPos);
-
- // Render proc for basic PICT graphic
- GE_CALLBACK(void,PICTRenderProc)(GrafElPtr element, GWorldPtr destGWorld);
-
- //-------------------------------------------------------------------------------------
- //Scrolling Graphic Element
- //-------------------------------------------------------------------------------------
-
- typedef struct {
- GrafElement baseGraphic;
- short hScroll; //horiz scroll for each changeIntrvl
- short vScroll; //vert scroll for each changeIntrvl
- short totalHScroll; //total current horizontal scroll
- short totalVScroll; //total current vertical scroll
- } ScrollingGraphic, *ScrlGraphicPtr;
-
- // Creation of PICT-based scrolling graphics
- GrafElPtr NewScrollingGraphic(GEWorldPtr world, OSType id, short plane,
- short resNum, short mode, short xPos, short yPos);
-
- //Start or stop (autoHScroll == autoVScroll == 0) auto-scrolling
- void AutoScrollGraphic(GEWorldPtr world, OSType elementID,
- short interval, short autoHScroll, short autoVScroll);
-
- // Manually set current scroll position
- void SetScroll(GEWorldPtr world, OSType elementID, short hScroll, short vScroll);
-
- // RenderProc for scrolling graphics
- GE_CALLBACK(void,RenderScrollingGraphic)(GrafElPtr graphic, GWorldPtr destGWorld);
-
- // AutoChangeProc for scrolling graphics
- GE_CALLBACK(void,ScrollGraphic)(GEWorldPtr world, GrafElPtr graphic);
-
- //-------------------------------------------------------------------------------------
- // Animated (frame-sequence) Graphic Element
- //-------------------------------------------------------------------------------------
-
- typedef enum { singleframe=0,
- reciprocating,
- loop,
- oneshotvanish,
- oneshotstop,
- oneshotloop} AnimSequence;
-
- typedef struct {
- GrafElement baseGraphic;
- short currentFrame; // number of frame now displayed
- short nFrames; // number of frames available
- AnimSequence seq; // type of animation
- } FrameSeqGraphic, *SeqGraphicPtr;
-
-
- // Creation of PICT-based multiframe graphics
- GrafElPtr NewAnimatedGraphic(GEWorldPtr world, OSType id, short plane,
- short resNum, short mode, short xPos, short yPos, short nFrames);
-
- // Activate or deactivate (interval == 0) automatic animation
- void AnimateGraphic(GEWorldPtr world, OSType elementID,
- short interval, AnimSequence sequence);
-
- // Manually set current frame
- void SetFrame(GEWorldPtr world, OSType elementID, short newFrame);
-
- // Frame sequence forwards or backwards
- void SetAnimDirection(GEWorldPtr world, OSType elementID, Boolean forward);
-
- // Increment or decrement current frame according to frame sequence
- void BumpFrame(GEWorldPtr world, OSType elementID);
-
- // Alternate interface to BumpFrame: avoid lookup when GrafElPtr available.
- // Also used as AutoChangeProc for frame-based graphics
- GE_CALLBACK(void,PtrBumpFrame)(GEWorldPtr world, GrafElPtr graphic);
-
- // Set horizontal and/or vertical mirroring
- // NOTE!! Only works for transparent FrameSeqGraphics using default BitCopyProc
- // and srcCopy FrameSeqGraphics which have been masked with MakeMask() (see FastBitCopies.h)
- void SetMirroring(GEWorldPtr world, OSType elementID, Boolean mirrorH, Boolean mirrorV);
-
- // RenderProc for frame-changing graphics
- GE_CALLBACK(void,RenderFrameGraphic)(GrafElPtr graphic, GWorldPtr destGWorld);
-
-
- //-------------------------------------------------------------------------------------
- //Simple one-line text graphic
- //-------------------------------------------------------------------------------------
-
- // Text graphic alignment modes; combine one horizontal mode and one vertical mode
- #define geHJustLeft 0x0001
- #define geHJustCenter 0x0002
- #define geHJustRight 0x0004
- #define geVJustTop 0x0100
- #define geVJustCenter 0x0200
- #define geVJustBottom 0x0400
-
- typedef struct {
- GrafElement baseGraphic;
- char *tgText; //pointer to text
- FontInfo tgFInfo; //FontInfo rec for text
- long tgFontNum; //etc.
- Rect tgRefRect;
- short tgFontSize;
- short tgFontFace;
- short tgAlignMode;
- RGBColor tgColor; //Color for text
- } TextGraphic, *TextGraphicPtr;
-
- // Create new text graphic
- // GrafElPtr NewTextGraphic(GEWorldPtr world, OSType id, short plane,
- // short xPos, short yPos, short mode,
- // StringPtr fontName, short txStyle, short size,
- // RGBColor color, StringPtr text);
-
- GrafElPtr NewTextGraphic(GEWorldPtr world, OSType id, short plane,
- Rect refRect, short alignMode,
- const char *fontName, short txStyle, short size,
- RGBColor color, char *text);
-
- // Change text of existing text graphic
- void SetTextGraphicText(GEWorldPtr world, OSType elementID, char *newText);
-
- // RenderProc for text graphics
- GE_CALLBACK(void,RenderTextGraphic)(GrafElPtr graphic, GWorldPtr destGWorld);
-
- #if defined(TARGET_IS_WIN95)
-
- // For Windows 95, we need to dispose the font. This will be done automatically,
- // UNLESS the application sets its own Cleanup Procedure for the element. In this
- // case, the application should call DisposeFont() when it has finished its own cleanup.
-
- GE_CALLBACK(void, DisposeFont)(GEWorldPtr world, GrafElPtr element);
-
- #endif
-
- //-------------------------------------------------------------------------------------
- // This Graphic Element tiles a single PICT into its (larger) animationRect
- //-------------------------------------------------------------------------------------
-
- GrafElPtr NewTiledGraphic(GEWorldPtr world, OSType id, short plane,
- short resNum, short mode, Rect destRect);
-
- // RenderProc for tiled graphics
- GE_CALLBACK(void,RenderTiledGraphic)(GrafElPtr graphic, GWorldPtr destGWorld);
-
- #ifdef __cplusplus
- }
- #endif
-
-
- #endif
-